import numpy
from scipy.linalg import circulant
import h5py
from math import pi,sqrt
from cmath import exp

D=2
V=8
t=10
skip=2

#First create hdf5 file
f=h5py.File('ring.hdf5','w')

#Create input group
ginput=f.create_group('input')

#Create parameters subgroup
gparam=ginput.create_group('parameters')
gparam['steps']=t
gparam['dimD']=D
gparam['dimV']=V
gparam['skip']=skip

#Create shift subgroup
gshift=ginput.create_group('shift')
#Create permutation matrices
vec=numpy.zeros(V,dtype=int)
vec[1]=1
p=circulant(vec)
gshift['0']=p
gshift['1']=p.T
gshift['0'].attr=0
gshift['1'].attr=1
#Create coin subgroup
coin=ginput.create_group('coin')
c=numpy.zeros((D,D),dtype=complex)
for k in range(D):
    for l in range(D):
        c[k,l]=(1/sqrt(D))*exp(2j*pi*k*l/D)
coin['C']=c


f.close()

